package com.u2ds.core.entity;

import com.alibaba.fastjson.JSONObject;
import com.cybermkd.mongo.kit.MongoBean;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @author Ethan
 * @date 上午8:37:18
 * @email windofdusk@gmail.com
 * 类说明
 */
public class BaseEntity extends JSONObject implements Serializable {

	private static final long serialVersionUID = 8631181785902069035L;
	
	public static final int YES = 1;
	public static final int NO = 0;

	public static final String id = "_id";

	public static final String createTime = "createTime";

	public static final String updateTime = "updateTime";



	@Override
	public int hashCode(){
		return Objects.hash(id);
	}

	public String getFullName(String shortName){
	    return this.getClass().getSimpleName() + "." + shortName;
    }

	@Override
	public boolean equals(Object object){
		if(object instanceof BaseEntity){
			return Objects.equals(this.id, ((BaseEntity)object).id);
		}
		return false;
	}

	public void clone(BaseEntity entity){
		entity.clear();
		for(String key : this.keySet()){
			entity.put(key, this.get(key));
		}
	}

}









